<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    protected $fillable = [
        'name',
        'description',
        'image',
        'sort_num'
    ];

    public function products()
    {
        return $this->hasMany(Product::class, 'category_id');
    }

    public function machines()
    {
        return $this->belongsToMany(Machine::class, 'category_machines', 'category_id', 'machine_id');
    }
}
